<?php
class Model_FacultyDocumentPublicity extends CCMIS_Model {
    //Database faculty_document_publicity

    public function __construct(){
        parent::__construct();
        $this->load->database();
    }

    public function getAll()
    {
        $sql = "SELECT * FROM faculty_document_publicity";
        $query =  $this->db->query($sql);
        $result = $query->result_array();
        return $result;
    }

    public function getById($id)
    {
        $sql = "SELECT * FROM faculty_document_publicity WHERE PublicityID LIKE ?";
        $query =  $this->db->query($sql, $id);
        $result = $query->row_array();
        return $result;
    }

    public function getDescById($id)
    {
        $sql = "SELECT Description FROM faculty_document_publicity WHERE PublicityID LIKE ?";
        $query =  $this->db->query($sql, $id);
        $result = $query->row_array();
        return $result['Description'];
    }

    public function getIdByDesc($desc)
    {
        $sql = "SELECT * FROM faculty_document_publicity WHERE Description LIKE ?";
        $query =  $this->db->query($sql, $desc);
        $result = $query->row_array();
        return $result['PublicityID'];
    }

}
